package com.bazaaroid.server.gae.security.enums;

public enum Authorities {
	ADMIN(0, "ROLE_ADMIN"),
	PARTNER(1, "ROLE_USER_PARTNER"),
	CLIENT(2, "ROLE_USER_CLIENT");
	
	private int value;
	private String authority;
	
	Authorities(int value, String authority) {
		this.value = value;
		this.authority = authority;
	}
	
	public int getValue() {
		return value;
	}

	public String getAuthority() {
		return authority;
	}

	public static String getAuthorityFromValue(int value) {
		String authorityStr = "ROLE_ANONYMOUS";
		for(Authorities authority : Authorities.values())
			if(authority.getValue() == value)
				authorityStr = authority.getAuthority();
		return authorityStr;
	}
}
